﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>DR钻戒后台管理系统</title>
    <link rel="stylesheet" href="css/public.css"/>
    <link rel="stylesheet" href="css/style.css"/>
    <script src="../js/jquery-1.12.4.js"></script>
</head>
<script type="text/javascript">

        function AddAdmin() {
            let adminName=$("#userName").val();
            let adminsex=$("#select").val();
            let adminBrithday=$("#data").val();
            let adminAge=$("#userAge").val();
            let adminPhone=$("#userphone").val();
            let adminAdeessr=$("#userAddress").val();

            if ($('#userName').val() == ''||$('#userName').val() == null) {
                alert("请填写用户名!")
                return false;
            }

            if ($('#select').val() == ''||$('#select').val() == null) {
                alert("请选择性别!")
                return false;
            }

            if ($('#data').val() == ''||$('#data').val() == null) {
                alert("请填写出生日期!")
                return false;
            }

            if ($('#userAge').val() == ''||$('#userAge').val() == null) {
                alert("请填写年龄!")
                return false;
            }

            if ($('#userphone').val() == ''||$('#userphone').val() == null) {
                alert("请填写联系电话!")
                return false;
            }

            if ($('#userAddress').val() == ''||$('#userAddress').val() == null) {
                alert("请填写地址!")
                return false;
            }

            $.getJSON("http://localhost:8080/DiamondRing/BackAddAdminServlet","adminName="+adminName+"&adminsex="+adminsex+"&adminBrithday="+adminBrithday+"&adminAge="+adminAge+"&adminPhone="+adminPhone+"&adminAdeessr="+adminAdeessr,function (data) {
                if (data>0){
                    alert("新增用户成功!");
                    location.href="http://localhost:8080/DiamondRing/back-stage-Management/userList.html";
                }else{
                    alert("新增用户失败!");
                }
            })
        }

</script>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>DR钻戒后台管理系统</h1>

    <div class="publicHeaderR">
        <a href="login.html">退出</a>
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器!</a>
</section>
<!--主体内容-->
<section class="publicMian ">
    <div class="left">
        <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
        <nav>
            <ul class="list">
                <li><a href="billList.html">订单管理</a></li>
                <li ><a href="providerList.html">商品管理</a></li>
                <li id="active"><a href="userList.html">用户管理</a></li>
                <li><a href="password.html">密码修改</a></li>
                <li><a href="login.html">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>用户管理页面 >> 用户添加页面</span>
        </div>
        <div class="providerAdd">
            <form action="#">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div>
                    <label for="userName">用户名称：</label>
                    <input type="text" name="userName" id="userName"/>
                    <span >*请输入用户名称</span>
                </div>
                <div>
                    <label for="userpassword">用户密码：</label>
                    <input type="text" name="userpassword" id="userpassword" readonly/>
                    <span>*密码默认为1111</span>
                </div>
                <div>
                    <label >用户性别：</label>

                    <select name="" id="select">
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                    <span></span>
                </div>
                <div>
                    <label for="userAge">用户年龄：</label>
                    <input type="text" name="userAge" id="userAge"/>
                    <span >*</span>
                </div>
                <div>
                    <label for="userphone">用户电话：</label>
                    <input type="text" name="userphone" id="userphone"/>
                    <span >*</span>
                </div>
                <div>
                    <label for="data">出生日期：</label>
                    <input type="text" name="data" id="data"/>
                    <span >*</span>
                </div>
                <div>
                    <label for="userAddress">用户地址：</label>
                    <input type="text" name="userAddress" id="userAddress"/>
                </div>
                <div class="providerAddBtn">
                    <a href="javascript:void(0)" onclick="AddAdmin()">保存</a>
                    <a href="userList.html">返回</a>
                </div>
            </form>
        </div>

    </div>
</section>
<footer class="footer">
</footer>
<script src="js/time.js"></script>

</body>
</html>